﻿@using BlazorWebassemblyMultiPagesTab.Client.Code
<div class="top-row ps-3 navbar navbar-dark">
    <div class="container-fluid">
        <a class="navbar-brand" href="">BlazorWebassemblyMultiPagesTab</a>        
    </div>
</div>

<div >
    <nav class="flex-column">
       <div class="nav-item px-3">
            <a class="nav-link" href="#" @onclick="@(e =>GoTo("首页","/"))">
                <span class="oi oi-home" aria-hidden="true"></span> Home
            </a>
        </div>
        <div class="nav-item px-3">
            <a class="nav-link" href="#" @onclick="@(e => GoTo("计数器","/counter"))">
                <span class="oi oi-plus" aria-hidden="true"></span> Counter
            </a>
        </div>
             <div class="nav-item px-3">
            <a class="nav-link" href="#" @onclick="@(e => GoTo("列表","/fetchdata"))">
                <span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
            </a>
        </div>
    </nav>
</div>


@code { 
     int i = 0;
    [CascadingParameter]
    protected INavMenu Menu { get; set; }
    private async Task GoTo(string title, string url)
    {
        if (i > 50)
        {
            i = 0;
        }
        i++;

        title = title + i;
        await Menu.GoTo(title, url);
    }
    //上面代码是为了测试标签滚动,正式请用下面代码
    /*
    [CascadingParameter]
    private INavMenu Menu { get; set; }
    private async Task GoTo(string title, string url)
    { 
        await Menu.GoTo(title, url);
    }
    */

}
